<?php
// +----------------------------------------------------------------------
// | 应用基础控制器
// +----------------------------------------------------------------------
// | Author: myh
// +----------------------------------------------------------------------
namespace app\pc\controller;

use think\App;
use app\BaseController;
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
use think\facade\Log;

class PcController extends BaseController
{   
    protected $user;
    
    public function __construct(App $app)
    {
        parent::__construct($app);
    }

    protected function initialize()
    {
        try{
            $token = $this->request->header('token');
            $device = $this->request->header('device');
            if($device == 'pc' && $token){
                $this->user = JWT::decode($token,new Key(config('app.jwt_code_pc'),'HS256'));
            }
        }catch (\Exception $e) {
            Log::write($e->getMessage());
        }
    }

}
